package com.example.springboot.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.springboot.entity.Orders;
import com.example.springboot.entity.OrdersPlus;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wgc
 * @since 2023-09-16
 */
public interface OrdersPlusMapper extends BaseMapper<OrdersPlus> {

    @Update("update orders_plus set state = #{state}, pay_time = #{paymentTime}, alipay_no=#{alipayNo} where no = #{no}")
    void OpUpdateState(@Param("no") String no, @Param("state") String state, @Param("paymentTime") String gmtPayment,
                     @Param("alipayNo") String alipayTradeNo);

    @Update("update orders_plus set state = #{state}, return_time = #{time} where no = #{no}")
    void OpUpdatePayState(@Param("no") String traceNo, @Param("state") String state, @Param("time") String time);

    @Select("select * from orders_plus where no = #{traceNo}")
    OrdersPlus getOpByNo(String traceNo);

    Page<OrdersPlus> ordersPlusPage(Page<OrdersPlus> page, @Param("name") String name, @Param("role") String role,
                                    @Param("userId") Integer userId);
}
